package day02_oop_code.com.itheima.d3_polymorphism;


public class Test {
    public static void main(String[] args) {
        Animal a = new Dog();
        a.cry();
        Dog d1 = (Dog) a;
        d1.lookDoor();

        Cat c = new Cat();
        go(c);

        Cat c1 = (Cat) a;
        c1.catchFish();
    }
    public static void go(Animal a){
        System.out.println("start");
        a.cry();
        if (a instanceof Dog){
            Dog d = (Dog)a;
            d.lookDoor();
        }

        if (a instanceof Cat){
            Cat c = (Cat)a;
            c.catchFish();
        }
        System.out.println("end");

    }
}
